﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BeatingMole
{
    /// <summary>
    /// Nguyễn Đặng Anh Duy
    /// MSSV : 11100204
    /// Email : itc.anhduy@gmail.com
    /// <summary>
    class CBusWeapons
    {
        #region "Variable"
        ContentManager _Content;
        CInfoWeapon _weapons;
        #endregion

        #region "Properties"
        public CInfoWeapon Weapons
        {
            set { _weapons = value; }
            get { return _weapons; }
        }
        #endregion

        #region "Constructor"
        public CBusWeapons(ContentManager content)
        {
            _Content = content;
            Weapons = GetWeapons(1);
        }
        #endregion



        #region "Method"
        public CInfoWeapon GetWeapons(int Value)
        {
            CInfoWeapon w = null;
            switch (Value)
            {
                case 1:
                    w = new CInfoHammerIron(_Content);
                    break;
                case 2:
                    w = new CInfoHammerLangya(_Content);
                    break;
            }
            return w;
        }
        public void PowerUp()
        {
            //Tăng sức mạnh vũ khí
        }

        public void UpdateWeapons(GameTime gameTime)
        {
            Weapons.Delay += (float)gameTime.ElapsedGameTime.TotalMilliseconds;
            if (Weapons.Delay > 150)
            {
                Weapons.Delay = 0;
                Weapons.IndexPosImagesCircle++;
                if (Weapons.IndexPosImagesCircle > Weapons.PosImagesCircle)
                    Weapons.IndexPosImagesCircle = 0;
            }
        }

        public void DrawWeapons(SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(Weapons.SpriteSheetCircle, new Vector2(760, 70), Weapons.XmlSpriteSheetCircle[Weapons.NameSpriteSheetCircle + Weapons.IndexPosImagesCircle.ToString()], Color.White, 0, Vector2.Zero, 0.3f, SpriteEffects.None, 1);
            spriteBatch.Draw(Weapons.SpriteSheet, new Vector2(770,  80), Weapons.XmlRectangle[Weapons.NameImages + Weapons.IndexPos.ToString()], Color.White, 0, Vector2.Zero, .2f, SpriteEffects.None, 1);
        }
        #endregion
    }
}
